<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CVS View</title>
<script language="javascript" type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script language="JavaScript" src="<%=basePath %>js/jquery-calendar.js"></script>
<link href="css/jquery-calendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
$(document).ready(function (){
	$("#startProposedDate,#endProposedDate,#startPtransDate,#endPtransDate").calendar({
		//初始化
		dateFormat: 'YMD/',     //日期格式
		timeSeparators:''       //时分设置
	});
});
//]]>
function LookCVS(cvsId) {
    document.getElementById("cvsInfoId").value = cvsId;
    document.forms["cvs"].action = "lookCVS_cvsView";
    document.forms["cvs"].submit();
}
function add() {
    document.forms["cvs"].action = "addDefault_cvsView";
    document.forms["cvs"].submit();
}
function EditCVS(cvsId) {
    document.getElementById("cvsInfoId").value = cvsId;
    document.forms["cvs"].action = "editCVS_cvsView";
    document.forms["cvs"].submit();
}
function searchBywrId() {
	document.forms["search"].action = "search_cvsView";
	document.forms["search"].submit();
}
function DeleteCVS(cvsId) {
	var r = confirm("确定删除么？");
	if (r)
	  {
		document.getElementById("cvsInfoId").value = cvsId;
		document.forms["cvs"].action = "delete_cvsView";
		document.forms["cvs"].submit();
	  }
}
function displayDiv() {
	document.getElementById("div").style.display = "";
}
</script> 
</head>
<body>
<%@ include file="topmenu.jsp" %>
<c:set var="id" value="${userInfo.roleid}"></c:set>
<CENTER>
<div id="container">

<div id="button" style="padding-left: 10px; margin-bottom: -20px; margin-top:10px;">
	<div style="padding-bottom:10px;">
		<s:submit value = "%{getText('COMMON_BUTTON_SEARCH')}" onclick="displayDiv();" 
		cssClass="ButtonCss"/>
	</div>
	<div style="padding-bottom:10px;">
		<c:if test="${id!=1}">
		<s:submit value = "%{getText('COMMON_BUTTON_ADD')}" onclick="add()" cssClass="ButtonCss"/>
		</c:if>
	</div>
</div>
	<div id="div" style="display: none;margin-top: 10px;">
	<s:form method = "post" name ="search" theme="simple">
	<table class="table" style="width:600px;">
		<tr align="left">
			<td align="left">関連案件NO
				<s:textfield name="cvsBean.relatedWrNO" cssStyle="width: 71px;"/>
			</td>
			<td align="left">マ一ジ担当
				<s:select list="cvsBean.selectListBean.allUserName" name = "cvsBean.userId" 
				listKey="key" listValue="name" headerValue="All" headerKey="0"cssStyle="width: 76px;"/>
			</td>
		</tr>
		<tr>
			<td align="left">作成者&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<s:select list="cvsBean.selectListBean.allUserName" name = "cvsBean.lastUserId" 
				listKey="key" listValue="name" headerValue="All" headerKey="0"cssStyle="width: 76px;"/>
			</td>
			<td align="left">アプリ名&nbsp;&nbsp;&nbsp;&nbsp;
				<s:select list="cvsBean.selectListBean.appNameList" name = "cvsBean.appId" 
				listKey="key" listValue="name" headerValue="All" headerKey="0"cssStyle="width: 76px;"/>
			</td>
		</tr>
		<tr>
		<td></td>
			<td align="right" style="padding-right:40px;">
				<s:submit value = "%{getText('COMMON_BUTTON_SUBMIT')}" onclick="searchBywrId()" cssClass="ButtonCss"/>
			</td>
		</tr>
	</table>
	</s:form>
	</div>
		<div id="content">
			<center>
				<table class="table">
					<tr>
						<th><s:text name ="CMS00001_LABEL_CVSID"/></th>
						<th> <s:text name ="CMS00001_LABEL_APPID"/> </th>
						<th><s:text name ="CMS00001_LABEL_CREATEDATE"/></th>
						<th><s:text name ="CMS00001_LABEL_CVSTYPE"/></th>
						<th><s:property value="%{getText('CMS00001_LABEL_TAGBEFORE')}" escape="false"/></th>
						<th><s:property value="%{getText('CMS00001_LABEL_TAGDONE')}" escape="false"/></th>
						<th><s:text name ="CMS00001_LABEL_RELATEDWR"/></th>
						<th><s:text name ="CMS00001_LABEL_CREATEUSER"/></th>
						<th><s:text name ="CMS00001_LABEL_LASTUPDATEUSER"/></th>
						<th><s:text name ="CMS00001_LABEL_LASTUPDATEDATE"/></th>
						<th><s:text name ="CMS00001_LABEL_COMMENTS"/></th>
						<th style="width:30px"> <s:text name="COMMON_BUTTON_LOOK"/> </th>
						<c:if test="${id!=1}"><th style="width:30px"><s:text name="COMMON_BUTTON_EDIT"/></th></c:if>
						<c:if test="${id!=1}"><th style="width:30px"><s:text name="COMMON_BUTTON_DELETE"/></th></c:if>
					</tr>
					<c:if test="${not empty cvsBean.allCvsList}">
						<c:forEach items="${cvsBean.allCvsList}" var="cvs">
						  <tr>
						  	  <td class="tdNumber">${cvs.rowNum}<input type="hidden" name="cvsId" value="${cvs.cvsId}"/></td>
							  <td class="tdString">${cvs.appId}</td>
							  <td class="tdString">${cvs.createDate} </td>
	                          <td class="tdString">${cvs.cvsType}</td>
	                          <td class="tdString">${cvs.tagBefore}</td>
	                          <td class="tdString">${cvs.tagDone}</td>
	                          <td class="tdString">${cvs.relatedWr}</td>
	                          <td class="tdString">${cvs.createUser}</td>
	                          <td class="tdString">${cvs.lastUpdateUser}</td>
	                          <td class="tdString">${cvs.lastUpdateDate}</td>
	                          <td class="tdString">${cvs.comments}</td>
	                          <td align="center"><input type="button" value = "V" onclick="LookCVS('${cvs.cvsId}');" class="ButtonCss" style="width:20px;"/></td>
	                          <td align="center"><input type="button" value = "E" onclick="EditCVS('${cvs.cvsId}');" class="ButtonCss" style="width:20px;"/></td>
	                          <td align="center"><input type="button" value = "D" onclick="DeleteCVS('${cvs.cvsId}');" class="ButtonCss" style="width:20px;"/></td>
						  </tr>
						</c:forEach>
					</c:if>
				</table>
			</center>
		</div>
		<div id="footer">Copyright accenture.com.cn</div>
		<s:form method = "post"  name ="cvs">
	    	<input type="hidden" name="cvsBean.cvsId" id="cvsInfoId"/>
	    </s:form>
</div>
</CENTER>
</body>
</html>	
	
